<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript"
	src="http://api.map.baidu.com/api?v=3.0&ak=NEVPuaso46TGp6IAWEyvVnP75mdbGtX4"></script>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<style type="text/css">
html {
	height: 100%
}

body {
	height: 100%;
	margin: 0px;
	padding: 0px
}

#container {
	width: 60%;
	height: 40%
}
</style>

</head>
<body>
	<div>
		<form action="../yogaclub/info" >
			场馆名称：<input type="text" name="yname"><br>
			电话：<input type="text" name="ytel"><br> 
			qq:<input type="text" name="yqq"><br> 
			地址：<input type="text" id="addr" name="yaddrmes"><br> 
			经纬度：<input type="text" id="jinwei"name="yaddress"><br>
			自我介绍:<input type="text"name="describe"><br>
			 <input type="submit" value="提交信息">
		</form>
	</div>
	<div id="container"></div>
	<div>
		<form action="../yogaclub/approve" >
			姓名：<input type="text" name="legalperson"><br> 
			身份证：<input type="text" name="yidcard"><br>
			 <input type="submit" value="提交审核信息">
		</form>
	</div>

	<script type="text/javascript">
		$(document).ready(
				function() {

					var map = new BMap.Map("container");
					var point = new BMap.Point(104.0699519292, 30.5790607666);
					map.centerAndZoom(point, 15);

					map.enableScrollWheelZoom(true);

					map.addControl(new BMap.NavigationControl()); //向地图中添加缩放控件
					var ctrlSca = new window.BMap.ScaleControl({
						anchor : BMAP_ANCHOR_BOTTOM_LEFT
					});
					map.addControl(ctrlSca); //比例尺  
					map.addControl(new BMap.MapTypeControl({
						mapTypes : [ BMAP_NORMAL_MAP, BMAP_SATELLITE_MAP,
								BMAP_HYBRID_MAP ]
					}));

				//	show(map);

					map.addEventListener("click", function(e) {
						var jinwei = e.point.lng + ", " + e.point.lat;
						$("#jinwei").val(jinwei);
					});

					var geoc = new BMap.Geocoder();
					map.addEventListener("click", function(e) {
						var pt = e.point;
						geoc.getLocation(pt, function(rs) {
							var addComp = rs.addressComponents;
							var context = addComp.province + addComp.city
									+ addComp.district + addComp.street
									+ addComp.streetNumber;
							$("#addr").val(context);
						});
					});

				});

		function show(map) {
			$.ajax({
				url : "/map/showcoach",
				type : "post",
				dataType : "json",
				success : function(data) {

					var myGeo = new BMap.Geocoder();

					var adds = [];

					for (var j = 0; j < data.length; j++) {
						var po = data[j];
						var arr = po.split(",");
						adds.push(new BMap.Point(arr[0], arr[1]));
					}

					for (var i = 0; i < adds.length; i++) {
						var marker = new BMap.Marker(adds[i]);
						map.addOverlay(marker);
						marker.setLabel(new BMap.Label("我是商圈:" + (i + 1), {
							offset : new BMap.Size(20, -10)
						}));
					}

				}
			});
		}
	</script>
</body>
</html>